#!/usr/bin/env python
#coding=utf-8
# author:wade
# contact: 317909531@qq.com
# datetime:2020/3/30 20:19
from rest_framework import serializers
from myclass import models
"""
文件说明：序列化数据类集合
"""

# 展示所有的扣分信息(被扣分班级，被扣分人，扣分原因，扣分时间，扣分年级)，表信息为MS_SCORE
class MS_SCORE_serializers(serializers.ModelSerializer):
    # ser_class =serializers.CharField(source='STUDENT_ID.NAME')
    class Meta:
        model = models.MS_SCORE
        fields = '__all__'
        # fields = ['ID','STUDENT_ID','UPDATED_BY','UPDATED_TIME']
        depth =4
class MS_CLASS_serializers(serializers.ModelSerializer):
    class Meta:
        model = models.MS_CLASS
        # fields = '__all__'
        fields = ['CLASS_NUM','ID']
        # depth = 5


class MS_GRADE_serializers(serializers.ModelSerializer):
    ms_classes = MS_CLASS_serializers(many=True, read_only=True)  #嵌套子序列化
    class Meta:
        model = models.MS_GRADE
        # fields = '__all__'
        fields = ['ID','STATUE', 'UPDATED_TIME','ms_classes']
        # depth = 5



        # depth = 1


